CREATE TABLE [dbo].[tb_Documentos]
(
[idDocumento] [int] NOT NULL IDENTITY(1, 1),
[Tramite] [int] NULL,
[Formulario] [int] NULL,
[TipoDocumento] [int] NULL,
[Titulo] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[Numero] [int] NOT NULL,
[Ano] [int] NOT NULL,
[Fecha] [datetime] NOT NULL,
[Registro] [int] NOT NULL,
[FirmaDigital] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[tb_Documentos] ADD CONSTRAINT [PK_tb_Documentos] PRIMARY KEY NONCLUSTERED  ([idDocumento]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[tb_Documentos] WITH NOCHECK ADD CONSTRAINT [FK_tb_Documentos_tb_Formularios] FOREIGN KEY ([Formulario]) REFERENCES [dbo].[tb_Formularios] ([idFormulario])
GO
ALTER TABLE [dbo].[tb_Documentos] WITH NOCHECK ADD CONSTRAINT [FK_tb_Documentos_tb_Usuarios] FOREIGN KEY ([Registro]) REFERENCES [dbo].[tb_Usuarios] ([idUsuario])
GO
ALTER TABLE [dbo].[tb_Documentos] ADD CONSTRAINT [FK_tb_Documentos_tb_TiposDeDocumentoDeGestion] FOREIGN KEY ([TipoDocumento]) REFERENCES [dbo].[tb_TiposDeDocumentoDeGestion] ([idTipoDocumento])
GO
ALTER TABLE [dbo].[tb_Documentos] WITH NOCHECK ADD CONSTRAINT [FK_tb_Documentos_tb_TramitesDocumentos] FOREIGN KEY ([Tramite]) REFERENCES [dbo].[tb_TramitesDocumentos] ([idTramite])
GO
